package com.hao.agent;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;

import java.nio.charset.Charset;

@SpringBootApplication
@ComponentScan(basePackages = "com.hao")
@EnableCaching
@EnableScheduling
public class AgentApplication {

	public static void main(String[] args) {
		SpringApplication.run(AgentApplication.class, args);
	}
	@Bean
	public RestTemplate restTemplate() {
		StringHttpMessageConverter m = new StringHttpMessageConverter(Charset.forName("UTF-8"));
		RestTemplate restTemplate = new RestTemplateBuilder().additionalMessageConverters(m).build();
		return restTemplate;
	}

}
